import { OrderStatus } from "../GameDef";
import { Order } from "../models/Order";

type OrderRuleMap = {
    [key: string]: (orderPool, ...args) => Order;

}

/**
 * 订单抽取顺序类, 用于抽取订单规则定义
 */

export class GenerateOrderRule {
    random(orderPool, ...args) {
        return orderPool.getRandomOrder(order => order.status == OrderStatus.NONE);
    }


    fix(orderPool, ...args) {
        const orderid = args[0] ? args[0] : undefined;
        if (orderid) {
            return orderPool.getOrderById(orderid);
        }
        return undefined;
    }

}